package com.example.demo.controller;

import com.example.demo.entity.Status;
import com.example.demo.service.StatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class StatusController {
    @Autowired
    StatusService statusService;


    // 参数解析：id 这个是一个根据 Pid 栏位，具体怎么给值请参考STATUS表里面的PID为空的栏位
    @GetMapping("/findStatus")
    public Map<String,Object> findStatus(@RequestParam(value = "id") Integer id){
        System.out.println("---------------");
        System.out.println(id);
        System.out.println("---------------");
        Map dataMap = new HashMap();
        List<Status> data = statusService.findOrderStatus(id);
        dataMap.put("status",'0');
        dataMap.put("data",data);
        return dataMap;
    }
}
